<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>el与data的两种写法</title>
    <script src="../../JS/vue.js"></script>
  </head>
  <body>
    <div id="root">
      <h3>{{name}}</h3>
      <h3>{{name}}</h3>
    </div>

    <script>
      // 两种写法同时谁在前执行谁
      // 第一种写法
      Vue.config.productionTip = false
      const vm = new Vue({
        el: '#root',

        data: {
          name: 'xiaomo',
        },
      })
      console.log(vm)
      //第二种写法
      new Vue({
        data() {
          console.log('@@@', this)
          return {
            name: 'xiaowan',
          }
        },
      })
      vm.$mount('#root')
    </script>
  </body>
</html>
